/*
 * CreateGui.java
 *
 * Created on 1 May 2007, 15:10
 *
 */

package gui;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.SwingUtilities;

import gui.markers.FigureMarkerFactory;

/**
 *
 * @author Slawek Wojcicki
 */
public class CreateGui {
    
    /** Creates a new instance of CreateGui */
    public CreateGui() {
        board = new Board(new Dimension(300,300));
        
        btDrawElipse = new JButton("rysujEllipse");
        btDrawElipse.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.ELLIPSE);
            }
        });
        btDrawRectangle = new JButton("rysujRectangle");
        btDrawRectangle.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.RECTANGLE);
            }
        });
        btDrawStraightLine = new JButton("rysujStraightLine");
        btDrawStraightLine.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.STRAIGHT_LINE);
            }
        });
        btDrawLine = new JButton("rysujLine");
        btDrawLine.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.LINE);
            }
        });
        btSelect = new JButton("zlap");
        btSelect.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.SELECT);
            }
        });
        btResize = new JButton("zmienRozmiar");
        btResize.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.setDrawingMode(FigureMarkerFactory.RESIZE);
            }
        });
        btClearLast = new JButton("cofnij");
        btClearLast.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.clearLastDrawnFigure();
            }
        });
        btRedoLast = new JButton("ponow");
        btRedoLast.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.redoLastDrawnFigure();
            }
        });
        btClearAll = new JButton("wyczysc");
        btClearAll.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                board.clearDrawing();
            }
        });
    }
    
    public Board board = null;
    public JButton
            btDrawElipse,
            btDrawRectangle,
            btDrawStraightLine,
            btDrawLine,
            btSelect,
            btResize,
            btClearLast,
            btRedoLast,
            btClearAll;
}
